<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.ArrayList,
                 com.scalar.chiptrack.operations.process.VendorLocation,
                 com.scalar.chiptrack.operations.vendor.dao.VendorDAO,
                 com.scalar.chiptrack.utils.ConfigManager"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/markAndPack.do"/>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<html:html locale="true">
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/mark_and_pack.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script language='javascript'>
    function back(){
       window.location = '<%=chipTracContext%>/processView.do?action=true&productID='+document.markAndPackForm.baseProductId.value;
    }
</script>
</HEAD>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" onLoad="javascript:whileLoad();">
<%
  java.util.ArrayList list = new java.util.ArrayList();
  list.add(new org.apache.struts.util.LabelValueBean("As Needed", "asneeded"));
  list.add(new org.apache.struts.util.LabelValueBean("Weekly", "weekly"));
  list.add(new org.apache.struts.util.LabelValueBean("Monthly", "monthly"));
  list.add(new org.apache.struts.util.LabelValueBean("Quarterly", "quarterly"));
  pageContext.setAttribute("poFrequencies", list);
%>
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
    <!-- Side Navigation start -->
    <%@ include file="/jsp/operations/operations_menu.jsp" %>
	</TD>
    <!-- end of the side navigations -->
    <TD bgcolor="#ffffff">
    <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
    <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
    <TD valign="top" width="100%" align="center">
    <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
    <BR>
    <!-- from here your body starts -->
    <center><span class="NArialW"><bean:write name="markAndPackForm" property="stepName"/></span></center>
    <p align="left"><chiptrack:errors styleClass="NArialL"/></p>
    <p align="left">
	<strong><font class="NArialL"><font color="FF0000"><font id="message"></font></font></font></strong>
	</p>
    <html:form name="markAndPackForm" type="com.scalar.chiptrack.operations.markandpack.forms.markAndPackForm" action="/markAndPack.do?action=save" enctype="multipart/form-data">
    <html:hidden name="markAndPackForm" property="baseProductId"/>
    <html:hidden name="markAndPackForm" property="stepName"/>
    <html:hidden name="markAndPackForm" property="previousStepId"/>
    <html:hidden name="markAndPackForm" property="trackId"/>
    <html:hidden name="markAndPackForm" property="previousStepName"/>
    <html:hidden name="markAndPackForm" property="processStepId"/>

    <table border="0" width="90%" align="center">
    <tr><td>
        <table border="0" width="100%" align=right>
        <tr>
            <td width="21%"><font class="NArialL">Mark and Pack Part Number:</font></td>
            <td width="28%" align="left"><font class="NArialL">
	            <html:text name="markAndPackForm" property="productName" size="17" styleClass="txfield"/></font><a href="javascript:addDupPartNumber('dupProductName','Mark and Pack Part Number');" title='Click here to add duplicate Product Name'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a>
                <!-- added by hareesh on 1st September 2003 -->
                <html:hidden name="markAndPackForm" property="oldProductName" />
            </td>
            <td width="5%">&nbsp;</td>
            <td width="18%"><font class="NArialL">Target Yield:</font></td>
            <td width="37%" align="left">
                <html:text name="markAndPackForm" property="targetYield" size="17" styleClass="txfield"/>
            </td>
        </tr>
		<logic:iterate name="markAndPackForm" property="dupProductName" id="xxxx">
			<tr>
				<td width="21%"><font class="NArialL"><font color=green>Mark and Pack Part Number:</font></font></td>
				<td width="28%" align="left">
					<input type="text" name="dupProductName" value="<%=xxxx%>" class=txfield size="17" maxlength="50" />
				</td>
			</tr>
		</logic:iterate>
		<tr>
			<td colspan='5'><font id="font1"></font></td>
		</tr>
		<tr>
			<td width="21%"><font class="NArialL">Standard Unit Cost:</font></td>
			<td width="28%" align="left">
				<html:text name="markAndPackForm" property="standardUnitCost" size="17" styleClass="txfield"/></td>
			<td width="5%">&nbsp;</td>
			<td width="18%"><font class="NArialL">Lot Scrap Yield Limit:</font></td>
			<td width="37%" align="left"><html:text name="markAndPackForm" property="lotScrapYieldLimit" size="17" styleClass="txfield"/></td>
		</tr>
		<tr>
			<td width="21%"><font class="NArialL">Procedure Doc. No:</font></td>
			<td width="28%" align="left"><font class="NArialL">
				<html:text name="markAndPackForm" property="procedureDocNumber" size="17" maxlength="20" styleClass="txfield"/></font></td>
			<td width="5%">&nbsp;</td>
			<td width="18%"><font class="NArialL">PO Frequency:</font></td>
			<td width="37%" align="left">
				<html:select name="markAndPackForm" property="poFrequency" styleClass="txfield">
					<html:option value="0">Select</html:option>
					<html:options collection="poFrequencies" property="value" labelProperty="label"/>
				</html:select>
			</td>
		</tr>
		<tr>
			<td width="21%"><font class="NArialL">Procedure Doc File:</font></td>
			<td width="28%" align="left"><font class="NArialL"><input type="file" name="procedureDocFile" size="9" class="txfield"></font></td>
			<td width="5%">&nbsp;</td>
			<td width="18%"><font class="NArialL">Visual&nbsp; System:</font></td>
			<td width="37%" align="left"><font class="NArialL">
				<html:text name="markAndPackForm" property="visualSystem" size="17" styleClass="txfield"/></font></td>
		</tr>
		<tr>
			<td width="21%"><font class="NArialL">Marking Diagram No:</font></td>
			<td width="28%" align="left"><font class="NArialL">
				<html:text name="markAndPackForm" property="markingDiagramNumber" size="17" styleClass="txfield"/></font></td>
			<td width="5%">&nbsp;</td>
			<td width="18%"><font class="NArialL">Packing Method:</font></td>
			<td width="37%" align="left"><font class="NArialL">
			<html:text name="markAndPackForm" property="packingMethod" size="17" styleClass="txfield"/></font></td>
		</tr>
		<tr>
			<td width="21%"><font class="NArialL">Marking Diagram:</font></td>
			<td width="28%" align="left"><font class="NArialL"><input type="file" name="markingDiagramFile" size="9" class="txfield"></font></td>
			<td width="65%" colspan="3">&nbsp;</td>
		</tr>
		<tr><td width="100%" colspan="5">&nbsp;</td></tr>
		<tr><td width="100%" colspan="5">&nbsp;</td></tr>
		<tr><td width="100%" colspan=5 class="NArialL">Comments:</td></tr>
		<tr><td width="100%" colspan=5 class="NArialL"><html:textarea rows="4" name="markAndPackForm" property="comments" cols="94" styleClass="txfield"/></td></tr>
    </table>
    </td></tr>
    <tr><td>
    <table border="0" width="90%" bordercolor="#FFFFFF">
      <tr>
         <td colspan=9 class="NArialL">Vendor Location Information:</td></tr>
      <tr>
	    <td width="5%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"></font></td>
	    <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Priority</font></td>
        <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Location</font></td>
        <td width="5%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">% Split</font></td>
        <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Capacity/Week</font></font></td>
        <td width="10%" align="center" bgcolor="#993333" colspan="2">
        <p align="center"><font color="#FFFFFF" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;
        <font class="NArialL"><font color="#FFFFFF">Cost/Unit&nbsp;&nbsp;</font>&nbsp;<font class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;
        <font color="#FFFFFF">Normal&nbsp; Express</font>
        </p></font></font></font></td>
	    <td width="10%" align="center" bgcolor="#993333" colspan="2">
	    <p align="center"><font color="#FFFFFF" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;
            <font class="NArialL"><font color="#FFFFFF">Cycle Time&nbsp;&nbsp;</font>&nbsp;<font class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;
            <font color="#FFFFFF">Normal&nbsp; Express</font>
        </p></font></font></font></td>
    </tr>
    <%
        ArrayList vendorLocations = (ArrayList) request.getAttribute("vendorLocations");
        if (vendorLocations == null) vendorLocations = new ArrayList();
        int size = vendorLocations.size();
        VendorLocation location = null;
        String locationName = null;
        for (int i=0; i<size; i++) {
            location = (VendorLocation) vendorLocations.get(i);
            locationName = location.getLocationName();
            if (locationName == null) locationName = "";
    %>
    <tr>
        <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type="checkbox" name="<%="select_"+i%>" onclick="checkLocation(<%=i%>,'select_')" <%if((location.getSelect() != null) && (location.getSelect().trim().length() != 0)) out.print ("checked");%>  class="txfield" value="off"/></font></td>        
        <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="priority" size="6" disabled="true" value='<%if (location.getPriority() != null) out.print (location.getPriority());%>' class="txfield" /></font></td>
        <td width="20%" align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  
        <input type="text" name="locationName"  value='<%=locationName%>' disabled="true" size="18" class="txfield">
        <input type="hidden" name="locationID" value='<%=location.getLocationIDAsInt()%>' size="18" class="txfield" /></font></td>
        <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="split" size="7" disabled="true" value='<%if (location.getSplit() != null) out.print (location.getSplit());%>' class="txfield" /></font></td>
        <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="capacityWeek" size="14" disabled="true" value='<%if (location.getCapacityWeek() != null) out.print (location.getCapacityWeek());%>' class="txfield" /></font></td>                                            
        <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="normalCost" size="6" disabled="true" value='<%=location.getNormalCost()%>' class="txfield" /></font></td>
        <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="expressCost" size="6" disabled="true" value='<%=location.getExpressCost()%>' class="txfield" /></font></td>
        <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="normalCycleTime" size="6" disabled="true" value='<%if (location.getNormalCycleTime() != null) out.print (location.getNormalCycleTime());%>' class="txfield" /></font></td>
        <td width="5%"  align="center"  bgcolor="#DEE1E2">  <font class="NArialL">  <input type=text name="expressCycleTime" size="6" disabled="true" value='<%if (location.getExpressCycleTime() != null) out.print (location.getExpressCycleTime());%>' class="txfield" /></font></td>
    </tr>
    <%
        }
    %>
  </table>
   <input type="hidden" name="count" value="<%=size%>" >
    </td></tr>
    <tr><td colspan=6 height="27">&nbsp;</td></tr>
    <tr>
         <td align=center colspan=6 height="27">
	     <!--a href="<%=chipTracContext%>/jsp/operations/class_store.jsp"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/back.gif" width="39" height="17"></a-->
         <chiptrack:restrictedLink functionality='<%=Functionality.PRODUCT_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:back();' onmouseover="window.status='Click here to go back to Process View';return true" onmouseout="window.status='';return true">
        <img border='0' src='<%=chipTracContext%>/jsp/includes/images/back.gif'></chiptrack:restrictedLink></a>
	     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		 <!--a href="javascript:saveMarkAndPack()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17"></a-->
         <chiptrack:restrictedLink functionality='<%=Functionality.PRODUCT_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:saveMarkAndPack();' onmouseover="window.status='Click here to save this Mark And Pack Process';return true" onmouseout="window.status='';return true">
         <img border='0' src='<%=chipTracContext%>/jsp/includes/images/next.gif'></chiptrack:restrictedLink>
		 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        </tr>
    </table>
  </html:form>
  <!-- till here -->
  <BR><BR><BR></TD>
  <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
  </TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</body>
</html:html>